package com.humh.annon;

import java.lang.reflect.Method;

/**
 * @PackageName: com.humh.annon
 * @ClassName: AnnotationProcessor
 * @Description:  注解处理
 * @author: hgx61
 * @date: 2024/6/21 15:57
 */

public class AnnotationProcessor {

  /**
   * 通过反射机制处理注解
   * @param args
   */
  public static void main(String[] args) {
    for (Method method : MyClass.class.getMethods()) {
      if (method.isAnnotationPresent(MyCustomAnnotation.class)) {
        MyCustomAnnotation annotation = method.getAnnotation(MyCustomAnnotation.class);
        System.out.println("Method: " + method.getName());
        System.out.println("Annotation number: " + annotation.number());
        System.out.println("Annotation value: " + annotation.value());
      }
    }
  }
}

